package edu.tsinghua.mrpvc.device.thermosensor;

import java.util.Dictionary;
import java.util.Hashtable;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;

import edu.tsinghua.mrpvc.device.ThermoSensor;
//import edu.tsinghua.mrpvc.simulate.util.SimulateTopic;


public class Activator implements BundleActivator, EventHandler {
//	private ThermoSensorImpl thermoSensor = null;
//	private static final String[] RESPONSE_TOPICS = {ThermoSensor.EVENT_TOPIC_ISVALID, ThermoSensor.EVENT_TOPIC_CURTEMP};
	//private static final String[] SIMULATE_TOPICS = {SimulateTopic.THERMO_SENSE};
	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
//		this.thermoSensor = new ThermoSensorImpl(context, "1");
//		context.registerService(ThermoSensor.class.getName(), thermoSensor, null);
		
//		Dictionary<String, Object> thermoSensorRes = new Hashtable<String, Object>();
//		thermoSensorRes.put(EventConstants.EVENT_TOPIC, RESPONSE_TOPICS);
//		context.registerService(EventHandler.class.getName(), thermoSensor, thermoSensorRes);
		/*
		Dictionary<String, Object> simulateTopic = new Hashtable<String, Object>();
		simulateTopic.put(EventConstants.EVENT_TOPIC, SIMULATE_TOPICS);
		context.registerService(EventHandler.class.getName(), this, simulateTopic);	
		*/	
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
	}

	@Override
	public void handleEvent(Event event) {
		// TODO Auto-generated method stub
		//this.thermoSensor.sense();		
	}

}
